const expressJwt = require('express-jwt');
const { PRIVATE_KEY } = require('../utils/constant');

const jwtAuth = expressJwt({
  secret: PRIVATE_KEY,
  algorithms:['HS256'],
  credentialsRequired: true // 设置为false就不进行校验了，游客也可以访问
}).unless({
  path: [
    '/',
    '/user/login',
    //客户端
    '/memberUser/login',
    '/home/bannerList',
    '/article/getArticleList',
    '/community/getLatelyList',
    '/community/getCategoryList',
    '/community/getCategory',
    '/article/getArticle',
    '/article/getSearchArticleList',
    '/article/getUserArticleList',
    '/home/centreList',
    '/memberUser/userInfo',
    '/memberUser/getFollower',
    '/memberUser/getFans'
  ],
});

module.exports = jwtAuth;